package com.wejoy.video.middle.station.data.enums.dict;


import com.wejoy.video.middle.station.data.exception.BusinessException;

/**
 * 全局内容类型
 *
 * @author: admin
 * @time: 2022/9/18 10:30
 */
public enum EnumGlobalContentType {
    INNER_PROTOCOL(-1, "内链", "%s", "", true, false),
    WEBVIEW(0, "外链", "/webView?url=%s", "", true, false),
    ;

    /**
     *
     */
    private Integer code;
    /**
     *
     */
    private String text;
    /**
     * APP 路由地址
     */
    private String url;
    /**
     * 选择数据的URL
     */
    private String chooseDataUrl;
    private Boolean show;

    /**
     * 是否首页底部工具栏
     */
    private Boolean indexTab;

    EnumGlobalContentType(Integer code, String text, String url, String chooseDataUrl, Boolean show, Boolean indexTab) {
        this.code = code;
        this.text = text;
        this.url = url;
        this.chooseDataUrl = chooseDataUrl;
        this.show = show;
        this.indexTab = indexTab;
    }

    public static EnumGlobalContentType getByCode(Integer code) {
        if (null == code) {
            return null;
        }
        for (EnumGlobalContentType type : EnumGlobalContentType.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new BusinessException("内容类型非法");
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getChooseDataUrl() {
        return chooseDataUrl;
    }

    public void setChooseDataUrl(String chooseDataUrl) {
        this.chooseDataUrl = chooseDataUrl;
    }

    public Boolean getShow() {
        return show;
    }

    public void setShow(Boolean show) {
        this.show = show;
    }

    public Boolean getIndexTab() {
        return indexTab;
    }

    public void setIndexTab(Boolean indexTab) {
        this.indexTab = indexTab;
    }
}
